#ifndef H_RCGD_CTRLFUNC_H
#define H_RCGD_CTRLFUNC_H

/*=================================================================*/
/*                           CTRLFUNC.C                            */
/*=================================================================*/
#define     MAX_OFFSET_COUNT  310
typedef struct OT_S{
    short InsertCount;
    short ModInsertCount;
    int   Offset[MAX_OFFSET_COUNT];
    int   Difference[MAX_OFFSET_COUNT];
    int   ModDifference[MAX_OFFSET_COUNT];
    short Count[MAX_OFFSET_COUNT];
} OT_;



/*=================================================================*/
/*                            declaration                          */
/*=================================================================*/
extern OT_  TimeOffsetTable;

extern OT_  TraceOffsetTable;

extern int     RAW_DIGITS, PREV_RAW_DIGITS;
extern double  RAW_DIFFERENCE,RAW_OFFSET;


extern void Init_CTRLFUNC();

extern void ReadRawCount(char check);
extern int Accumulate();

extern void PWM(void);
//kang extern void ChangeDACValue(int volt);

extern void InitOffsetTable(OT_ *);

extern int GetTimeOffset(OT_ *,int);
extern void InsertTimeOffset(OT_ *,int, int);


extern void ReadRawCount(char check);
extern void InitializePLL();


extern void ChangeTCConversionTable(int);

void MakePWMInterval(double DAC_);


#endif
